#ifndef _DRAW_OBJECT_
#define _DRAW_OBJECT_

#if defined(__APPLE_CC__)
	#include <OpenGL/gl.h>
	#include <OpenGL/glu.h>
#else
	#include <GL/gl.h>
	#include <GL/glu.h>
#endif

#include "../tools/Point.h"
#include "Color.h"
/*
	The bread and butter of all drawing.
	In order to draw anything onto the screen, it should inherit from OrthoObject for 2D, or ModelObject for 3D
	The default behavior is for all objects to be drawn, meaning the constructor automatically adds itself to a draw list.
	To change whether or not a particular object is drawn, just call EnableDraw() or DisableDraw() as necessary. 
	drawEnabled tells you where the object lies in the draw lists.
*/
class DrawObject {
public:
	DrawObject(float x = 0, float y = 0, float z = 0, float r = 1, float g = 1, float b = 1);
	virtual ~DrawObject()	{}
	virtual void draw(unsigned long) = 0;		//override this function for how you want your object drawn
	virtual void EnableDraw() = 0;
	virtual void DisableDraw() = 0;
	
	bool drawEnabled;
	
	fVec3D drawPos;		//a vector to work with for where you want something drawn
	Color color;			//a color to work with to specify a color
};

/** 2D object, the z value specifies draw ordering, want front things drawing after back things*/
class OrthoObject: public DrawObject {
public:
	OrthoObject(float x = 0, float y = 0, float z = 0, float r = 1, float g = 1, float b = 1);
	virtual ~OrthoObject();

	void EnableDraw();
	void DisableDraw();
	
	bool operator<(const OrthoObject& o) const;	// To allow for draw ordering
};

/** 3D object */
class ModelObject: public DrawObject {
public:
	ModelObject(float x = 0, float y = 0, float z = 0, float r = 1, float g = 1, float b = 1);
	virtual ~ModelObject();
	
	fVec3D orientation;		//a vector to do orientations with
	
	void EnableDraw();
	void DisableDraw();
};

/**
	A sample case of a 2D object. Will draw an outlined rectangle in 2D with lower left corner 'drawPos' and width and height
	specified in 'dimensions'.	
*/
class DebugRect: public OrthoObject {
public:
	DebugRect() {}
	fVec2D dimensions;
	void draw(unsigned long);
};

/**
	A sample case of a 3D object. Will draw 3 axis aligned planes at 'drawPos', each 2*'w' wide
*/
class DebugDrawSpot: public ModelObject {
	float w;
public:
	DebugDrawSpot(float x = 0, float y = 0, float z = 0, float r = 1, float g = 1, float b = 1, float width = 1) :
		ModelObject(x,y,z,r,g,b), w(width) {}
	void draw(unsigned long);
};

#endif
